From 216542720fe62c0ece339018a7223a4014ad7e42 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 24 Nov 2020 12:07:40 -0600 Subject: [PATCH] Mark unit and integration tests --- tests/test_check_settings.py | 7 +++++++ tests/test_menu.py | 8 ++++++++ tests/test_pgwui_menu.py | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/tests/test_check_settings.py b/tests/test_check_settings.py index 6160807..8626dda 100644 --- a/tests/test_check_settings.py +++ b/tests/test_check_settings.py @@ -19,6 +19,8 @@ # Karl O. Pinc +import pytest + import pgwui_menu.check_settings as check_settings from pgwui_common import checkset @@ -53,6 +55,7 @@ mock_boolean_settings = testing.make_mock_fixture( # validate_order +@pytest.mark.unittest def test_validate_order_nosetting(): '''No error is delivered when there's no setting''' errors = [] @@ -61,6 +64,7 @@ def test_validate_order_nosetting(): assert errors == [] +@pytest.mark.unittest def test_validate_order_ok(): '''No errors when all components in the ordering are ok ''' @@ -71,6 +75,7 @@ def test_validate_order_ok(): assert errors == [] +@pytest.mark.unittest def test_validate_order_singleton(): '''A non-list as an ordering gets the right error ''' @@ -82,6 +87,7 @@ def test_validate_order_singleton(): assert isinstance(errors[0], menu_ex.BadOrderValuesError) +@pytest.mark.unittest def test_validate_order_bad_component(): '''Deliver error when a bad component name is supplied in the ordering ''' @@ -101,6 +107,7 @@ mock_validate_order = testing.make_mock_fixture( # check_settings() +@pytest.mark.unittest def test_check_settings(mock_unknown_settings, mock_require_settings, mock_boolean_settings, diff --git a/tests/test_menu.py b/tests/test_menu.py index 4eb2f94..a5f44d6 100644 --- a/tests/test_menu.py +++ b/tests/test_menu.py @@ -19,6 +19,8 @@ # Karl O. Pinc +import pytest + import copy import pyramid.testing @@ -39,6 +41,7 @@ mock_route_url = testing.instance_method_mock_fixture('route_url') # build_menu() +@pytest.mark.unittest def test_build_menu_no_component(): '''When the plugin has no setting the menu is not modified ''' @@ -48,6 +51,7 @@ def test_build_menu_no_component(): assert menu_items == [] +@pytest.mark.unittest def test_build_menu_component_with_route(mock_route_url): '''When the plugin has a setting and a route the route is returned with the label @@ -68,6 +72,7 @@ def test_build_menu_component_with_route(mock_route_url): assert menu_items == [(test_plugin, test_route, plugin_settings)] +@pytest.mark.unittest def test_build_menu_component_no_route(mock_route_url): '''When the plugin has a setting and no route, the menu is not modified ''' @@ -92,6 +97,7 @@ mock_build_menu = testing.make_mock_fixture( # build_menu_items() +@pytest.mark.unittest def test_build_menu_items_component_no_plugin_conf(mock_build_menu): '''Components given in the pgwui_menu.order setting are added in order, other components are added alphabetically, the pgwui_menu @@ -119,6 +125,7 @@ def test_build_menu_items_component_no_plugin_conf(mock_build_menu): assert call_args[3][0][3] == 'plugin4' +@pytest.mark.unittest def test_build_menu_items_no_order(mock_build_menu): '''When there is no order setting components are added alphabetically ''' @@ -148,6 +155,7 @@ mock_build_menu_items = testing.make_mock_fixture( # menu_view() +@pytest.mark.unittest def test_menu_view(pyramid_config, mock_find_pgwui_components, mock_build_menu_items): diff --git a/tests/test_pgwui_menu.py b/tests/test_pgwui_menu.py index 3a4ef76..d17f894 100644 --- a/tests/test_pgwui_menu.py +++ b/tests/test_pgwui_menu.py @@ -19,6 +19,8 @@ # Karl O. Pinc +import pytest + import pyramid.config import pgwui_menu.pgwui_menu as pgwui_menu @@ -29,6 +31,7 @@ from pgwui_testing import testing # init_menu() +@pytest.mark.unittest def test_init_menu(): '''A menu_label is set ''' @@ -47,6 +50,7 @@ mock_add_route = testing.instance_method_mock_fixture('add_route') mock_scan = testing.instance_method_mock_fixture('scan') +@pytest.mark.unittest def test_includeme( mock_init_menu, mock_add_static_view, mock_add_route, mock_scan): '''add_static_view, add_route, and scan are all called @@ -65,6 +69,7 @@ def test_includeme( # Integration tests +@pytest.mark.integrationtest def test_includeme_integration(): config = pyramid.config.Configurator() pgwui_menu.includeme(config) -- 2.34.1